﻿var mobileHG_uname = $('#mobileHG_username');
var mobileHG_upwd = $('#mobileHG_password');
var mobileHG_cardnum = $('#mobileHG_cardnum');
var mobileHG_cardpwd = $('#mobileHG_cardpass');
var code = $('#mobileHG_code');

$MobileHgo = $("#btn_mobileHG_submit");
$MobileHgo.click(function () {
    var mobileHG_uname = $('#mobileHG_username');
    var mobileHG_upwd = $('#mobileHG_password');
    var mobileHG_cardnum = $('#mobileHG_cardnum');
    var mobileHG_cardpwd = $('#mobileHG_cardpass');
    var code = $('#mobileHG_code');
    if (mobileHG_uname.val() == '') {
        alert(mobileHG_uname.attr('msg'));
        mobileHG_uname.focus();
        return false;
    }
    if (mobileHG_upwd.val() == '') {
        alert(mobileHG_upwd.attr('msg'));
        mobileHG_upwd.focus();
        return false;
    }
    if (mobileHG_cardnum.val() == '') {
        alert(mobileHG_cardnum.attr('msg'));
        mobileHG_cardnum.focus();
        return false;
    }
    if (mobileHG_cardpwd.val() == '') {
        alert(mobileHG_cardpwd.attr('msg'));
        mobileHG_cardpwd.focus();
        return false;
    }
    if (code.val() == '') {
        alert('验证码不能为空');
        code.focus();
        return false;
    }

    $.post("handler/MobileHGCz.ashx", { username: mobileHG_uname.val(), pwd: mobileHG_upwd.val(), cardnum: mobileHG_cardnum.val(), cardpwd: mobileHG_cardpwd.val(), code: code.val() }, function (data) {

        switch (data) {
            case "":
                alert("手机号码或者手机密码充值卡号或充值卡密码不允许为空！");
                $("#img_code4").attr("src", "common/RegImg.aspx?id=" + Math.random());
                break;
            case "0":
                alert("验证码输入不正确！");
                $("#img_code4").attr("src", "common/RegImg.aspx?id=" + Math.random());

                code.focus();
                break;
            case "-1":
                alert("服务器忙,请稍后再试！");
                break;
            default:
                alert(data);
                mobileHG_upwd.val("");
                mobileHG_cardnum.val("");
                mobileHG_cardpwd.val("");
                code.val("");
                $("#img_code4").attr("src", "common/RegImg.aspx?id=" + Math.random());
                break;

        }
        return false;

    })

})